package zzjson.rabbitmq.ack;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import zzjson.rabbitmq.BaseRabbitMq;

import java.io.IOException;

/**
 * <p>****************************************************************************</p>
 * <p><b>Copyright © 2010-2019 shuncom team All Rights Reserved<b></p>
 * <ul style="margin:15px;">
 * <li>Description : zzjson.rabbitmq.ack</li>
 * <li>Version     : 1.0.0</li>
 * <li>Creation    : 2019年04月29日</li>
 * <li>@author     : zzy0_0</li>
 * </ul>
 * <p>****************************************************************************</p>
 */
public class ACKProducer {
	private final static String QUEUE_NAME = "TEST_ACK_QUEUE";

	public static void main(String[] args) throws IOException {
		Connection conn = BaseRabbitMq.getConn();
		Channel channel = conn.createChannel();

		String msg = "test ack message 拒收 ";
		channel.queueDeclare(QUEUE_NAME, false, false, false, null);

		for (int i = 0; i < 5; i++) {
			channel.basicPublish("", QUEUE_NAME, null, (msg + i).getBytes());
		}

		BaseRabbitMq.close(channel, conn);
	}
}